package com.database.common;

import com.database.common.result.CommonResult;

@SuppressWarnings("serial")
public class ResponseException extends RuntimeException {
	private BaseResultCodeEnum exceptionEnums;

	public ResponseException(BaseResultCodeEnum exceptionEnums) {
		this.exceptionEnums = exceptionEnums;
	}

	public BaseResultCodeEnum getExceptionEnums() {
		return exceptionEnums;
	}
	
	public static CommonResult buildException(ResponseException responseException){
		BaseResultCodeEnum enums = responseException.getExceptionEnums();
		CommonResult result = new CommonResult();
		result.setResultCode(enums.getCode());
		result.setResultMsg(enums.getMsg());
		return result;  
	}
}
